using System.ComponentModel.DataAnnotations;

namespace ProcessManagementApi.DTOs
{
    /// <summary>
    /// 工序查询条件DTO
    /// </summary>
    public class ProcessQueryDto
    {
        /// <summary>
        /// 工序编码/名称（模糊查询）
        /// </summary>
        public string? NumberOrName { get; set; }

        /// <summary>
        /// 工序分类ID
        /// </summary>
        public int? ProcessCategoryId { get; set; }

        /// <summary>
        /// 所属部门
        /// </summary>
        public string? Department { get; set; }

        /// <summary>
        /// 负责人
        /// </summary>
        public string? ResponsiblePerson { get; set; }

        /// <summary>
        /// 状态（启用/禁用）
        /// </summary>
        public bool? IsActive { get; set; }

        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 页面大小
        /// </summary>
        public int PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 工序响应DTO
    /// </summary>
    public class ProcessResponseDto
    {
        /// <summary>
        /// ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        public string ProcessNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序名称
        /// </summary>
        public string ProcessName { get; set; } = string.Empty;

        /// <summary>
        /// 工序分类ID
        /// </summary>
        public int ProcessCategoryId { get; set; }

        /// <summary>
        /// 工序分类名称
        /// </summary>
        public string ProcessCategoryName { get; set; } = string.Empty;

        /// <summary>
        /// 所属部门
        /// </summary>
        public string? Department { get; set; }

        /// <summary>
        /// 负责人
        /// </summary>
        public string? ResponsiblePerson { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 状态显示
        /// </summary>
        public string IsActiveDisplay => IsActive ? "启用" : "禁用";

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 附件原始文件名
        /// </summary>
        public string? AttachmentFileName { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? CreatedBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 更新人
        /// </summary>
        public string? UpdatedBy { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedTime { get; set; }
    }

    /// <summary>
    /// 工序创建DTO
    /// </summary>
    public class ProcessCreateDto
    {
        /// <summary>
        /// 工序编号
        /// </summary>
        [Required(ErrorMessage = "工序编号不能为空")]
        [StringLength(50, ErrorMessage = "工序编号长度不能超过50个字符")]
        public string ProcessNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序名称
        /// </summary>
        [Required(ErrorMessage = "工序名称不能为空")]
        [StringLength(100, ErrorMessage = "工序名称长度不能超过100个字符")]
        public string ProcessName { get; set; } = string.Empty;

        /// <summary>
        /// 工序分类ID
        /// </summary>
        [Required(ErrorMessage = "工序分类不能为空")]
        public int ProcessCategoryId { get; set; }

        /// <summary>
        /// 所属部门
        /// </summary>
        [StringLength(100, ErrorMessage = "所属部门长度不能超过100个字符")]
        public string? Department { get; set; }

        /// <summary>
        /// 负责人
        /// </summary>
        [StringLength(50, ErrorMessage = "负责人长度不能超过50个字符")]
        public string? ResponsiblePerson { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public bool IsActive { get; set; } = true;

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500, ErrorMessage = "备注长度不能超过500个字符")]
        public string? Remarks { get; set; }
    }

    /// <summary>
    /// 工序更新DTO
    /// </summary>
    public class ProcessUpdateDto
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required(ErrorMessage = "ID不能为空")]
        public int Id { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        [Required(ErrorMessage = "工序编号不能为空")]
        [StringLength(50, ErrorMessage = "工序编号长度不能超过50个字符")]
        public string ProcessNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序名称
        /// </summary>
        [Required(ErrorMessage = "工序名称不能为空")]
        [StringLength(100, ErrorMessage = "工序名称长度不能超过100个字符")]
        public string ProcessName { get; set; } = string.Empty;

        /// <summary>
        /// 工序分类ID
        /// </summary>
        [Required(ErrorMessage = "工序分类不能为空")]
        public int ProcessCategoryId { get; set; }

        /// <summary>
        /// 所属部门
        /// </summary>
        [StringLength(100, ErrorMessage = "所属部门长度不能超过100个字符")]
        public string? Department { get; set; }

        /// <summary>
        /// 负责人
        /// </summary>
        [StringLength(50, ErrorMessage = "负责人长度不能超过50个字符")]
        public string? ResponsiblePerson { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500, ErrorMessage = "备注长度不能超过500个字符")]
        public string? Remarks { get; set; }
    }

    /// <summary>
    /// 工序导出查询DTO
    /// </summary>
    public class ProcessExportQueryDto
    {
        /// <summary>
        /// 工序编码/名称（模糊查询）
        /// </summary>
        public string? NumberOrName { get; set; }

        /// <summary>
        /// 工序分类ID
        /// </summary>
        public int? ProcessCategoryId { get; set; }

        /// <summary>
        /// 所属部门
        /// </summary>
        public string? Department { get; set; }

        /// <summary>
        /// 负责人
        /// </summary>
        public string? ResponsiblePerson { get; set; }

        /// <summary>
        /// 状态（启用/禁用）
        /// </summary>
        public bool? IsActive { get; set; }
    }
} 